/*
 * $Id: PolisAclGroupKey.java 27 2007-04-13 01:02:48Z aaron.day $
 */
package org.crazydays.core.data;


import java.io.Serializable;

import javax.persistence.*;

/**
 * PolisAclGroupKey
 */
@Embeddable
public class PolisAclGroupKey
	implements Serializable
{
	/** serial version uid */
	public final static long serialVersionUID = "$Id: PolisAclGroupKey.java 27 2007-04-13 01:02:48Z aaron.day $".hashCode();

	/** acl id */
	@Basic
	@Column(name = "polis_acl")
	protected long aclId;

	/** group id */
	@Basic
	@Column(name = "polis_group")
	protected long groupId;

	/** right id */
	@Basic
	@Column(name = "polis_right")
	protected long rightId;

	/**
	 * Set acl id.
	 * 
	 * @param aclId Acl id
	 */
	public void setAclId(long aclId)
	{
		this.aclId = aclId;
	}

	/**
	 * Get acl id.
	 * 
	 * @return Acl id
	 */
	public long getAclId()
	{
		return aclId;
	}

	/**
	 * Set group id.
	 * 
	 * @param groupId Group id
	 */
	public void setGroupId(long groupId)
	{
		this.groupId = groupId;
	}

	/**
	 * Get group id.
	 * 
	 * @return Group id
	 */
	public long getGroupId()
	{
		return groupId;
	}

	/**
	 * Set right id.
	 * 
	 * @param rightId Right id
	 */
	public void setRightId(long rightId)
	{
		this.rightId = rightId;
	}

	/**
	 * Get right id.
	 * 
	 * @return Right id
	 */
	public long getRightId()
	{
		return rightId;
	}

	/**
	 * Object equals key.
	 * 
	 * @param Object
	 * @return Equal
	 */
	public boolean equals(Object o)
	{
		if (o == null) {
			return false;
		} else if (o instanceof PolisAclGroupKey) {
			PolisAclGroupKey key = (PolisAclGroupKey) o;

			return getAclId() == key.getAclId()
					&& getGroupId() == key.getGroupId()
					&& getRightId() == key.getRightId();
		} else {
			return false;
		}
	}

	/**
	 * Hash code.
	 * 
	 * @return Hash code
	 */
	public int hashCode()
	{
		return toString().hashCode();
	}

	/**
	 * String representation.
	 * 
	 * @return String
	 */
	public String toString()
	{
		StringBuffer buffer = new StringBuffer();

		buffer.append("aclId: ");
		buffer.append(getAclId());
		buffer.append(" groupId: ");
		buffer.append(getGroupId());
		buffer.append(" rightId: ");
		buffer.append(getRightId());

		return buffer.toString();
	}
}
